package com.fingard.dsp.bank.directbank.bozz11;

import com.fingard.dsp.bank.directbank.DirectBase;

public class BOZZ11Base extends DirectBase {
	protected String getCharset() {
		return getBankConfig().getCharset("GBK");
	}

	/**
	 * 字符串向左填充指定位数空格
	 * 
	 * @param sourceStr
	 * @param strLength
	 * @return
	 * @throws Exception
	 */
	public String leftFill(String sourceStr, int strLength) throws Exception {
		int length = 0;
		try {
			if (null != sourceStr) {
				length = sourceStr.getBytes(getCharset()).length;
			}
			for (int i = 0; i < strLength - length; i++) {
				if (sourceStr == null)
					sourceStr = " ";
				else
					sourceStr = " " + sourceStr;
			}
		} catch (Exception e) {
			throw (e);
		}
		return sourceStr;
	}

	/**
	 * 字符串空格去除
	 * 
	 * @param sourceStr
	 * @return
	 */
	public String delBlank(String sourceStr) {
		return sourceStr.replaceAll(" ", "");
	}
}